<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.hrm.settings.ChgPasswdReminder"%>
<%@ include file="/hrm/header.jsp" %>
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page"/><!-- 分部 -->
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/><!-- 部门 -->
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/><!-- 人力资源 -->
<%
	String imagefilename = "/images/hdReport_wev8.gif";
	String titlename = SystemEnv.getHtmlLabelName(179,user.getLanguage())+"："+SystemEnv.getHtmlLabelName(16559,user.getLanguage())+"—"+SystemEnv.getHtmlLabelName(15505,user.getLanguage()) ;
	String needfav ="1";
	String needhelp ="";
	
	boolean hasViewAllRight=false;
	if(HrmUserVarify.checkUserRight("BohaiInsuranceScheduleReport:View", user)){
		hasViewAllRight=true;
	}
	
	String isself = Util.null2String(request.getParameter("isself"));

	Calendar today = Calendar.getInstance ();
	String currentDate = Util.add0(today.get(Calendar.YEAR), 4) + "-"
					   + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-"
					   + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2);//获取当前日期
	
	String fromDate = Util.null2String(request.getParameter("fromDate"));//开始时间
	String toDate = Util.null2String(request.getParameter("toDate"));//结束时间
	
	String CTNo = Util.null2String(request.getParameter("CTNo"));//餐厅编号
	
	ChgPasswdReminder reminder=new ChgPasswdReminder();
	RemindSettings settings=reminder.getRemindSettings();
	String checkUnJob = Util.null2String(settings.getCheckUnJob(),"0");//非在职人员信息查看控制 启用后，只有有“离职人员查看”权限的用户才能检索非在职人员
%>
<html>
	<head>
		<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
		<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
		<SCRIPT language="javascript" src="/js/datetime_wev8.js"></script>
		<SCRIPT language="javascript" defer="defer" src="/js/JSDateTime/WdatePicker_wev8.js"></script>		
		<script language="javascript">
			function ajaxinit(){
				var ajax=false;
				try {
					ajax = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						ajax = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (E) {
						ajax = false;
					}
				}
				if (!ajax && typeof XMLHttpRequest!='undefined') {
					ajax = new XMLHttpRequest();
				}
				return ajax;
			}
			
			//点击搜索后，页面自动加载事件
			function showdata(){
				var ajax=ajaxinit();
				ajax.open("POST", "wxmbbSjxs.jsp", true);
				ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				ajax.send("fromDate=<%=fromDate%>&toDate=<%=toDate%>&CTNo=<%=CTNo%>");
				//获取执行状态
				ajax.onreadystatechange = function() {
					//如果执行状态成功，那么就把返回信息写到指定的层里
					if (ajax.readyState == 4 && ajax.status == 200) {
						try{
							document.all("showdatadiv").innerHTML=ajax.responseText;
						}catch(e){
							return false;
						}
					}
				}
			}
			
			<!-- 搜索 -->
			function submitData() {
				if(document.frmMain.fromDate.value !="" && document.frmMain.toDate.value !=""){
					if(document.frmMain.fromDate.value > document.frmMain.toDate.value) {
						window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(16721,user.getLanguage())%>") ;
					}else{
						document.frmMain.submit();
					}
				}else {
					document.frmMain.submit();
				}
			}
			
			<!-- 导出 -->
			function exportExcel(){
				if(document.frmMain.fromDate.value=="" && document.frmMain.toDate.value=="" && $("#CTNo").val()==""){
						window.top.Dialog.alert("请选条件！！！");
				}else{
					if(document.frmMain.fromDate.value !="" && document.frmMain.toDate.value !=""){
						if(document.frmMain.fromDate.value > document.frmMain.toDate.value) {
							window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(16721,user.getLanguage())%>") ;
						}else{
							document.getElementById("excels").src = "wxmbbDc.jsp?cmd=CheckWorkAttendance&tnum=20078&fromDate="+document.frmMain.fromDate.value+"&toDate="+document.frmMain.toDate.value+"&CTNo=<%=CTNo%>";
						}
					}else {
						document.getElementById("excels").src = "wxmbbDc.jsp?cmd=CheckWorkAttendance&tnum=20078&fromDate="+document.frmMain.fromDate.value+"&toDate="+document.frmMain.toDate.value+"&CTNo=<%=CTNo%>";
					}
				}
				
			}
     
			//重置
			function reset(){
				jQuery("#fromDate").val("");
				jQuery("#rzrqspan1").html("");
				jQuery("#toDate").val("");
				jQuery("#rzrqspan2").html("");
				jQuery("#CTNo").val("");
				jQuery("#resourceId").attr("value","");
				jQuery("#resourceIdspan").html("");
				jQuery("#frmMain").find("select").selectbox("reset");
			}
			//提示窗口
			jQuery(document).ready(function(){
				jQuery("#message_table_Div").hide();
				var pTop= document.body.offsetHeight/2+document.body.scrollTop-50;   
				var pLeft= document.body.offsetWidth/2-50;   
				jQuery("#message_table_Div").css("position", "absolute");
				jQuery("#message_table_Div").css("top", pTop);
				jQuery("#message_table_Div").css("left", pLeft); 
				<%if(isself.equals("1")){%>
					jQuery("#message_table_Div").show();
				<%}%>
			})
		</script>
	</head>
	<body onload="<%=isself.equals("1")?"showdata()":""%>">
		<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
		
		<!-- 右键菜单栏 -->
		<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
		<%
			RCMenu += "{"+SystemEnv.getHtmlLabelName(197,user.getLanguage())+",javascript:submitData(),_self} " ;//搜索
			RCMenuHeight += RCMenuHeightStep ;
			if(hasViewAllRight){
				RCMenu += "{"+SystemEnv.getHtmlLabelName(199,user.getLanguage())+",javascript:reset(),_self}" ;//重置
				RCMenuHeight += RCMenuHeightStep ;
			}
			RCMenu += "{"+SystemEnv.getHtmlLabelName(28343,user.getLanguage())+",javascript:exportExcel(),_self} " ;//导出
			RCMenuHeight += RCMenuHeightStep ;
		%>
		<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
		<table id="topTitle" cellpadding="0" cellspacing="0">
			<tr>
				<td></td>
				<td class="rightSearchSpan" style="text-align:right;">
					<input type=button class="e8_btn_top" onclick="submitData();" value="<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%>"></input><!-- 搜索 -->
					<input type=button class="e8_btn_top" onclick="exportExcel();" value="<%=SystemEnv.getHtmlLabelName(28343,user.getLanguage())%>"></input><!-- 导出 -->
					<span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage())%>" class="cornerMenu"></span><!-- 菜单 -->
				</td>
			</tr>
		</table>
		<form id=frmMain name=frmMain method=post action="wxmbbZym.jsp">
			<input type="hidden" name="isself" value="1">
			<wea:layout type="4col">
				<wea:group context='<%=SystemEnv.getHtmlLabelName(15505,user.getLanguage())%>'><!-- 报表条件 -->
					<wea:item><%=SystemEnv.getHtmlLabelName(97,user.getLanguage())%></wea:item><!-- 日期 -->
					<wea:item>
						<button type="button" class="Calendar" id="rzrqbtn2" onclick="getDate(rzrqspan1,fromDate)"></button> 
						<span id="rzrqspan1"><%=fromDate%></span> 
						<input type="hidden" name="fromDate" id="fromDate" value="<%=fromDate%>">
							-&nbsp;&nbsp; 
						<button type="button" class="Calendar" id="rzrqbtn2" onclick="getDate(rzrqspan2,toDate)"></button> 
						<span id="rzrqspan2"><%=toDate%></span> 
						<input type="hidden" name="toDate" id="toDate" value="<%=toDate%>">
					</wea:item>
					<wea:item>餐厅编号</wea:item>
					<wea:item><input type="text" id="CTNo" name="CTNo" value="<%=CTNo%>"></wea:item>
				</wea:group>
			</wea:layout>
			<wea:layout type="2col">
				<wea:group context='<%=SystemEnv.getHtmlLabelNames("15101,356",user.getLanguage())%>' ><!-- 报表结果 -->
					<wea:item>
						<div id="showdatadiv" style="<%=isself.equals("1")?"":"display:none"%>;width:98%">
							<div id='message_table_Div' class="xTable_message">
								<%=SystemEnv.getHtmlLabelName(20204,user.getLanguage())%><!-- 正在处理数据，请稍候.... -->
							</div>
						</div>
					</wea:item>
				</wea:group>
			</wea:layout>
		</form>
		<iframe name="excels" id="excels" src="" style="display:none" ></iframe>
	</body>
</html>